<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{layout/default}">
<head>
    <title>登录状态检查</title>
</head>
<body>
    <div layout:fragment="content" class="fade-in">
        <div class="card">
            <div class="card-header">
                <h5 class="mb-0">登录状态检查</h5>
            </div>
            <div class="card-body">
                <div th:if="${isAuthenticated}" class="alert alert-success">
                    <h4><i class="fas fa-check-circle me-2"></i>您已登录</h4>
                    <p>用户名: <strong th:text="${currentUser.username}">用户名</strong></p>
                    <p>邮箱: <span th:text="${currentUser.email}">邮箱</span></p>
                    <p>角色: <span th:text="${currentUser.role}">角色</span></p>
                    <hr>
                    <div class="d-grid gap-2 d-md-flex">
                        <a href="/profile" class="btn btn-primary">
                            <i class="fas fa-user-circle me-2"></i>访问个人中心
                        </a>
                        <a href="/items/new" class="btn btn-success">
                            <i class="fas fa-plus-circle me-2"></i>发布新信息
                        </a>
                        <a href="/claims/user" class="btn btn-info text-white">
                            <i class="fas fa-hand-holding-heart me-2"></i>我的认领
                        </a>
                    </div>
                </div>
                
                <div th:unless="${isAuthenticated}" class="alert alert-warning">
                    <h4><i class="fas fa-exclamation-triangle me-2"></i>您尚未登录</h4>
                    <p>请先登录后再访问个人中心和其他功能。</p>
                    <div class="d-grid gap-2 d-md-flex">
                        <a href="/login" class="btn btn-primary">
                            <i class="fas fa-sign-in-alt me-2"></i>登录
                        </a>
                        <a href="/register" class="btn btn-success">
                            <i class="fas fa-user-plus me-2"></i>注册
                        </a>
                    </div>
                </div>
                
                <div class="mt-4">
                    <h5>调试信息</h5>
                    <pre class="bg-light p-3">
Authentication: [[${#authentication}]]
SecurityContext: [[${#request.userPrincipal}]]
Session ID: [[${#session.id}]]
                    </pre>
                </div>
            </div>
        </div>
    </div>
</body>
</html> 